/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modelo;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Edgar
 */
@Entity
@Table(name = "consumidor_ingreso")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ConsumidorIngreso.findAll", query = "SELECT c FROM ConsumidorIngreso c"),
    @NamedQuery(name = "ConsumidorIngreso.findByIdConsumidorIngreso", query = "SELECT c FROM ConsumidorIngreso c WHERE c.idConsumidorIngreso = :idConsumidorIngreso")})
public class ConsumidorIngreso implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_consumidor_ingreso")
    private Integer idConsumidorIngreso;
    @JoinColumn(name = "id_consumidor", referencedColumnName = "id_consumidor")
    @ManyToOne(optional = false)
    private Consumidor idConsumidor;
    @JoinColumn(name = "id_ingreso", referencedColumnName = "id_ingreso")
    @ManyToOne(optional = false)
    private Ingreso idIngreso;

    public ConsumidorIngreso() {
    }

    public ConsumidorIngreso(Integer idConsumidorIngreso) {
        this.idConsumidorIngreso = idConsumidorIngreso;
    }

    public Integer getIdConsumidorIngreso() {
        return idConsumidorIngreso;
    }

    public void setIdConsumidorIngreso(Integer idConsumidorIngreso) {
        this.idConsumidorIngreso = idConsumidorIngreso;
    }

    public Consumidor getIdConsumidor() {
        return idConsumidor;
    }

    public void setIdConsumidor(Consumidor idConsumidor) {
        this.idConsumidor = idConsumidor;
    }

    public Ingreso getIdIngreso() {
        return idIngreso;
    }

    public void setIdIngreso(Ingreso idIngreso) {
        this.idIngreso = idIngreso;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idConsumidorIngreso != null ? idConsumidorIngreso.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ConsumidorIngreso)) {
            return false;
        }
        ConsumidorIngreso other = (ConsumidorIngreso) object;
        if ((this.idConsumidorIngreso == null && other.idConsumidorIngreso != null) || (this.idConsumidorIngreso != null && !this.idConsumidorIngreso.equals(other.idConsumidorIngreso))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "modelo.ConsumidorIngreso[ idConsumidorIngreso=" + idConsumidorIngreso + " ]";
    }
    
}
